// <com.woyouqiu.Copyright>
// --------------------------------------------------------------
// <copyright>上海有求网络科技有限公司 2015</copyright>
// <Solution>Vecen.BangChuang</Solution>
// <Project>Vecen.BangChuang.Application</Project>
// <FileName>ClassGroupOutDto.cs</FileName>
// <CreateTime>2017-05-06 14:13</CreateTime>
// <Author>何苗</Author>
// <Email>hemiao@woyouqiu.com</Email>
// <log date="2017-05-06 14:13" version="00001">创建</log>
// --------------------------------------------------------------
// </com.woyouqiu.Copyright>

using System;
using Abp.Application.Services.Dto;
using Abp.AutoMapper;
using Abp.Timing;
using Abp.Timing.Timezone;

namespace Vecen.BangChuang.BangChuang.Classes.Dtos {
    /// <summary>
    /// 课程分组
    /// </summary>
    [AutoMapFrom(typeof(ClassGroup))]
    public class ClassGroupOutDto: EntityDto {

        /// <summary>
        /// 分组名称
        /// </summary>
        public string GroupName { get; set; }

        /// <summary>
        /// 缩略图ID
        /// </summary>
        public int? AvatarId { get; set; }

        /// <summary>
        /// 时间段
        /// </summary>
        public string Period
        {
            get
            {
                var startDate = StartDate.HasValue ? Clock.Normalize(StartDate.Value).ToString("yyyy.MM.dd") : "";
                var endDate = EndDate.HasValue ? (StartDate.HasValue && EndDate.Value.Year == StartDate.Value.Year)
                    ? Clock.Normalize(EndDate.Value).ToString("MM.dd")
                    : Clock.Normalize(EndDate.Value).ToString("yyyy.MM.dd") : "";
                return startDate + "-" + endDate;
            }
        }


        /// <summary>
        /// 课程开始日期
        /// </summary>
        public DateTime? StartDate { get; set; }

        /// <summary>
        /// 课程结束日期
        /// </summary>
        public DateTime? EndDate { get; set; }

        /// <summary>
        /// 课程数量
        /// </summary>
        public int ClassCount { get; set; }
    }
}